<?php

$mysqli = new mysqli("mysql-88.ukraine.com.ua", "barthez_ai", "x9gedv4w", "barthez_ai");

$query = "SELECT * FROM msmessages";

$map = array();

$map[] = '/';

if ($result = $mysqli->query($query)) {
    while ($row = $result->fetch_assoc()) {
       $map[] = '/message/'.$row["messageId"];
    }
    $result->close();
}

for($i=0;$i<325;$i++) {
	$p = $i*77;
	$map[] = '/vka/vk2.php?start='.$p.'&amp;count=77';
}

print'<pre>';
print_r($map);
print'</pre>';

@unlink('sitemap.xml');
$f = fopen('sitemap.xml','w');

$s = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>
<urlset xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd\" xmlns=\"http://www.sitemaps.org/schemas/sitemap/0.9\">
\n";
$s = $s."\r\n";
fwrite($f,$s);


$disabled = file('disabled.txt');

foreach ($map as $key => $value)
{
  $s = '   <url>';
  $s = $s."\r\n";
  fwrite($f,$s);

  $s = '      <loc>http://deeflow.com'.$value.'</loc>';
  $s = $s."\r\n";
  fwrite($f,$s);

  $s = '      <lastmod>'.date('Y-m-d\TH:i:s').'+00:00</lastmod>';
  $s = $s."\r\n";
  fwrite($f,$s);

  $s = '      <changefreq>daily</changefreq>';
  $s = $s."\r\n";
  fwrite($f,$s);

  $s = '      <priority>0.2</priority>';
  $s = $s."\r\n";
  fwrite($f,$s);

  $s = '   </url>';
  $s = $s."\r\n";
  fwrite($f,$s);
}

$s = '</urlset>';
$s = $s."\r\n";
fwrite($f,$s);

fclose($f);
